package com.honeycomb.article;

import java.util.Arrays;


public enum SearchPattern {
	LAST_FIRST,
	EARLY_FIRST,
	HOT_FIRST,
	FOLLOWS,
	FAVOUR;
	
	/**
	 * 根据传入字符串来返回对应的文章类型
	 */
	public static SearchPattern getSearchPattern(String strValue) {
		try {
			SearchPattern pattern = valueOf(strValue);
			return pattern;
		}
		catch(Exception ex) {
			throw new IllegalArgumentException("Value '" + strValue + "' is not allowed in SearchPattern. Only "
					+ Arrays.toString(SearchPattern.values()) + " are allowed."
					);
		}
	}

}
